# 提交定单
from selenium.webdriver.common.by import By


class PageEcshopFrontSubmitOriders():
    '''提交定单'''
    def __init__(self, driver):
        self.driver = driver

    # 定义定位器
    loc_fornt_submit_orders_submit_door = (By.XPATH, '//table[@id="shippingTable"]/tbody/tr[3]/td[1]/input')
    loc_fornt_submit_submit_arrival = (By.XPATH, '//table[@id="paymentTable"]/tbody/tr[4]/td[1]/input')
    loc_fornt_submit_submit_theform = (By.XPATH, '//form[@id="theForm"]/div[11]/div[2]/input[1]')
    loc_submit_orders_assert = (By.XPATH, '//table[@id="paymentTable"]/tbody/tr[3]/td[2]/strong/font')
    loc_submit_orders_asserta = (By.XPATH, '//table[@id="paymentTable"]/tbody/tr[3]/td[2]/strong')
    loc_sumit_orders_asserts = (By.XPATH, '//div[@class="flowBox"]/h6')

    # 上门取货
    def fornt_submit_orders_submit_door(self):
        self.driver.find_element(*self.loc_fornt_submit_orders_submit_door).click()

    # 货到付款
    def fornt_submit_submit_arrival(self):
        self.driver.find_element(*self.loc_fornt_submit_submit_arrival).click()

    # 点击提交定单
    def fornt_submit_submit_theform(self):
        self.driver.find_element(*self.loc_fornt_submit_submit_theform).click()

    def front_submit_orders(self):
        self.fornt_submit_orders_submit_door()
        self.fornt_submit_submit_arrival()
        self.fornt_submit_submit_theform()

    # 支付方式安装断言
    def submit_orders_assert(self):
        actuall = self.driver.find_element(*self.loc_submit_orders_assert).text
        return actuall

    # 支付方式卸载断言
    def submit_orders_asserta(self):
        actualla = self.driver.find_element(*self.loc_submit_orders_asserta).text
        return actualla

    # 定单生成断言
    def sumit_orders_asserts(self):
        asserts = self.driver.find_element(*self.loc_sumit_orders_asserts).text
        return asserts
